package com.gc.business.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.gc.common.utils.StringUtils;
import org.springframework.stereotype.Service;
import com.gc.business.mapper.ContractInfoMapper;
import com.gc.business.domain.ContractInfo;
import com.gc.business.service.IContractInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;

/**
 * 合同 服务层实现
 * 
 * @author liujinteng
 * @date 2020-11-09
 */
@Slf4j
@Service
public class ContractInfoServiceImpl extends ServiceImpl<ContractInfoMapper, ContractInfo> implements IContractInfoService {

    @Override
    public List<ContractInfo> list(ContractInfo contractInfo){
        LambdaQueryWrapper<ContractInfo> wrapper = new LambdaQueryWrapper<>();
        if(contractInfo != null){
            if(StringUtils.isNotEmpty(contractInfo.getContractId())){
                wrapper.eq(ContractInfo::getContractId, contractInfo.getContractId());
            }
            if(StringUtils.isNotEmpty(contractInfo.getContractNum())){
                wrapper.eq(ContractInfo::getContractNum, contractInfo.getContractNum());
            }
            if(StringUtils.isNotEmpty(contractInfo.getContractName())){
                wrapper.like(ContractInfo::getContractName, contractInfo.getContractName());
            }
            if(StringUtils.isNotEmpty(contractInfo.getSignUnit())){
                wrapper.like(ContractInfo::getSignUnit, contractInfo.getSignUnit());
            }
            if(StringUtils.isNotEmpty(contractInfo.getContractPrincipal())){
                wrapper.like(ContractInfo::getContractPrincipal, contractInfo.getContractPrincipal());
            }
            if(StringUtils.isNotEmpty(contractInfo.getLinkWay())){
                wrapper.eq(ContractInfo::getLinkWay, contractInfo.getLinkWay());
            }
            if(StringUtils.isNotEmpty(contractInfo.getSignDate())){
                wrapper.eq(ContractInfo::getSignDate, contractInfo.getSignDate());
            }
            if(StringUtils.isNotEmpty(contractInfo.getContractAmount())){
                wrapper.eq(ContractInfo::getContractAmount, contractInfo.getContractAmount());
            }
            if(StringUtils.isNotEmpty(contractInfo.getRemark())){
                wrapper.eq(ContractInfo::getRemark, contractInfo.getRemark());
            }
            if(StringUtils.isNotEmpty(contractInfo.getCreateBy())){
                wrapper.eq(ContractInfo::getCreateBy, contractInfo.getCreateBy());
            }
            if(StringUtils.isNotEmpty(contractInfo.getCreateTime())){
                wrapper.eq(ContractInfo::getCreateTime, contractInfo.getCreateTime());
            }
            if(StringUtils.isNotEmpty(contractInfo.getUpdateBy())){
                wrapper.eq(ContractInfo::getUpdateBy, contractInfo.getUpdateBy());
            }
            if(StringUtils.isNotEmpty(contractInfo.getUpdateTime())){
                wrapper.eq(ContractInfo::getUpdateTime, contractInfo.getUpdateTime());
            }
        }
        return baseMapper.selectList(wrapper);
    }
}
